package com.zhong.gang.app.dialog;

import android.content.Context;

import androidx.annotation.NonNull;

import com.zhong.gang.applib.dialog.SlideDialog;

import java.util.ArrayList;
import java.util.List;

public class AddressTypeDialog extends SlideDialog {
    public static final int GANG_TYPE = 0;
    public static final int LIAO_TYPE = 1;
    private List<AddressTypeBean> data = new ArrayList<>();
    public AddressTypeDialog(@NonNull Context context) {
        super(context);
        data.clear();
        data.add(new AddressTypeBean("钢厂",GANG_TYPE));
        data.add(new AddressTypeBean("料场",LIAO_TYPE));
    }

    public List<AddressTypeBean> getData() {
        return data;
    }

    @Override
    public void initView() {
        super.initView();
        List<String> listdata = new ArrayList<>();
        for (AddressTypeBean bean:getData()){
            listdata.add(bean.getStr());
        }
        bind.loop.setArrayList(listdata);
        bind.loop.setNotLoop();
    }

    @Override
    public void finish() {
        if (listener != null) {
            int postion = bind.loop.getCurrentItem();
            if (getData().size()>postion) {
                AddressTypeBean baseBean = getData().get(postion);
                listener.onSlideBack(baseBean);
            }
        }
    }
}
